﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MenuList.aspx.cs" Inherits="Crm_MenuList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="crm.css" rel="stylesheet" type="text/css" /> 
    
    <script src="../js/jquery-1.4.2.min.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(document).ready(function()
        {
            var selobj = null;
            var selobjcolor = null;
            //d = this.style.backgroundColor; this.style.backgroundColor = '#D1F880';
            $(".trnei,.lupai").each(function()
            {

                $(this).click(function()
                {
                    try
                    {
                        selobj.css("background-color", selobjcolor);
                    }
                    catch (ex)
                    {
                    }
                    selobjcolor = $(this).css("background-color");
                    $(this).css("background-color", "#D1F880");
                    selobj = $(this);
                });
            });

        });
    </script>
</head>
<body>
    <form id="form1" runat="server">   
    
    <div style="padding:0 5px;"><div class="nav">当前位置：菜单管理</div><div style="margin-bottom:5px;"><asp:Button ID="btnAddNew" runat="server" Text="新建菜单" onclick="btnAddNew_Click" /></div>
      <asp:GridView ID="gvList" runat="server" AutoGenerateColumns="False"  
        DataKeyNames="id">
        <Columns>           
            <asp:BoundField DataField="ID" HeaderText="id" InsertVisible="False" 
                ReadOnly="True" SortExpression="id"  Visible="false"/>
            <asp:BoundField DataField="MenuId" HeaderText="菜单编码" 
                SortExpression="MenuId" />
            <asp:BoundField DataField="ParentId" HeaderText="父级编码" 
                SortExpression="ParentId" />
            <asp:BoundField DataField="MenuName" HeaderText="菜单名称" 
                SortExpression="MenuName" />
            <asp:BoundField DataField="Path" HeaderText="页面路径" 
                SortExpression="Path" />
            <asp:BoundField DataField="MenuType" HeaderText="菜单类型(0=父级/1=子级)"  Visible="false"
                SortExpression="MenuType" />
                 <asp:CommandField HeaderText="操作" ShowDeleteButton="True" ShowEditButton="True" />
        </Columns>
    </asp:GridView>
    </div>
 
    
    <asp:AccessDataSource ID="accessdata" runat="server" DataFile="~/App_Data/db.mdb"
      SelectCommand="SELECT * FROM [Crm_Menus] order by MenuId " 
        DeleteCommand="DELETE FROM [Crm_Menus] WHERE [ID] = ?" 
        InsertCommand="INSERT INTO [Crm_Menus] ([ID], [MenuId], [ParentId], [MenuName], [Path], [MenuType]) VALUES (?, ?, ?, ?, ?, ?)" 
        
        UpdateCommand="UPDATE [Crm_Menus] SET [MenuId] = ?, [ParentId] = ?, [MenuName] = ?, [Path] = ?, [MenuType] = ? WHERE [ID] = ?">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="MenuId" Type="Int32" />
            <asp:Parameter Name="ParentId" Type="Int32" />
            <asp:Parameter Name="MenuName" Type="String" />
            <asp:Parameter Name="Path" Type="String" />
            <asp:Parameter Name="MenuType" Type="Int32" />
            <asp:Parameter Name="ID" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="ID" Type="Int32" />
            <asp:Parameter Name="MenuId" Type="Int32" />
            <asp:Parameter Name="ParentId" Type="Int32" />
            <asp:Parameter Name="MenuName" Type="String" />
            <asp:Parameter Name="Path" Type="String" />
            <asp:Parameter Name="MenuType" Type="Int32" />
        </InsertParameters>
     </asp:AccessDataSource>
    
    <asp:SqlDataSource ID="sqserverlData" runat="server" ConnectionString="<%$ ConnectionStrings:strWeb %>" DeleteCommand="DELETE FROM [Crm_Menus] WHERE [ID] = @ID" InsertCommand="INSERT INTO [Crm_Menus] ([MenuId], [ParentId], [MenuName], [Path], [MenuType]) VALUES (@MenuId, @ParentId, @MenuName, @Path, @MenuType)" SelectCommand="SELECT * FROM [Crm_Menus]" UpdateCommand="UPDATE [Crm_Menus] SET [MenuId] = @MenuId, [ParentId] = @ParentId, [MenuName] = @MenuName, [Path] = @Path, [MenuType] = @MenuType WHERE [ID] = @ID">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="MenuId" Type="Int32" />
            <asp:Parameter Name="ParentId" Type="Int32" />
            <asp:Parameter Name="MenuName" Type="String" />
            <asp:Parameter Name="Path" Type="String" />
            <asp:Parameter Name="MenuType" Type="Int32" />
            <asp:Parameter Name="ID" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="MenuId" Type="Int32" />
            <asp:Parameter Name="ParentId" Type="Int32" />
            <asp:Parameter Name="MenuName" Type="String" />
            <asp:Parameter Name="Path" Type="String" />
            <asp:Parameter Name="MenuType" Type="Int32" />
        </InsertParameters>
    </asp:SqlDataSource>
    
    </form>
</body>
</html>
